package SuperPow;

public class Solution {
    public int superPow(int a, int[] b) {
        long ans=1;
    	for (int i=0;i<=b.length-1;i++){
    		ans=pow(ans,10)%1337;
        	ans=ans*pow(a,b[i])%1337;
        }
    	return (int) ans;
    }

	private long pow(long a, long i) {
		if (i==0) return 1;
		if (i==1) return a%1337;
	    long temp=pow(a,i/2)%1337;
	    if (i%2==1) return temp*temp*a%1337;
	    else return temp*temp;
		
	}   
	
	public static void main(String args[]){
		int a=2147483647;
		int[] b={2,0,0};
		Solution so=new Solution();
		System.out.println(so.superPow(a,b));
	}
}
